package ufpr.ees.suhck.dao.planosaude;

import java.util.List;
import org.hibernate.Query;
import ufpr.ees.suhck.dao.GenericDaoImpl;
import ufpr.ees.suhck.db.HibernateUtil;
import ufpr.ees.suhck.model.PlanoSaude;

public class PlanoSaudeDaoImpl extends GenericDaoImpl<PlanoSaude, Long> implements PlanoSaudeDao {

    public List<PlanoSaude> findPorCnpj(String cnpj) {
        sf = HibernateUtil.getSessionFactory().openSession();
        Query query = sf.getNamedQuery(PlanoSaude.FIND_POR_CNPJ);
        query.setParameter("cnpj", "%" + cnpj + "%");
        List<PlanoSaude> planosSaude = query.list();
        sf.close();
        return planosSaude;
    }
}
